#include "SDL2/SDL.h"

#include "KeyEvent.h"
#include "MenuState.h"

KeyEvent::KeyEvent(int code)
        : code(code)
{
}

KeyEvent::~KeyEvent()
{
}

GameState* KeyEvent::visitMenuState(MenuState* menuState) const
{
    switch (code)
    {
    case SDLK_1:
        return menuState->performMenuAction1();

    case SDLK_2:
        return menuState->performMenuAction2();

    case SDLK_3:
        return menuState->performMenuAction3();

    case SDLK_ESCAPE:
        return menuState->performMenuActionEscape();

    case SDLK_BACKSPACE:
        return menuState->performMenuActionBackspace();

    case SDLK_RETURN:
        return menuState->performMenuActionReturn();

    default:
        return NULL;
    }
}

